import time

import peewee as pw

from apiCenter.config import  DatabaseConfig

class BaseModel(pw.Model):
    class Meta:
        database = pw.SqliteDatabase(DatabaseConfig.db_host)

class TestModel(BaseModel):
    id = pw.PrimaryKeyField()
    f_name = pw.TextField(null=True, verbose_name='测试字段名字')


class DefaultCols:
    d_create_at = pw.DateTimeField(default=time.time(), verbose_name='创建时间')
    f_create_by = pw.CharField(null=True, verbose_name='创建者')
    d_update_at = pw.DateTimeField(default=time.time(), verbose_name='更新时间')
    f_update_by = pw.CharField(null=True, verbose_name='更新者')
    b_is_delete = pw.IntegerField(default=0, verbose_name='删除|0:否,1是,2其他')
    b_is_show = pw.IntegerField(default=1, verbose_name='显示|0:否,1是,2其他')
    b_is_enable = pw.IntegerField(default=1, verbose_name='可用|0:否,1是,2其他')
